package org.gpp.proj1.ui;

import java.util.Map;
import java.util.Set;

import org.gpp.proj1.communication.CommunicationException;
import org.gpp.proj1.logic.core.board.RobotPosition;
import org.gpp.proj1.logic.metadata.RobotPartCategory;
import org.gpp.proj1.map.GameMap;
import org.gpp.proj1.ui.controller.ISRGUIController;

/**
 * Interface for a SomeRobotGame User Interface 
 * @author Paolo Victor, paolovictor@gmail.com
 */
public interface ISRGUIView {

	/**
	 * Sets the controller that the view is registered to
	 * @param controller
	 */
	public void setController(ISRGUIController controller);
	
	/**
	 * Notifies the UI to show a a profile selection prompt
	 */
	public void notifyLoadProfile();

	/**
	 * Notifies the UIs that the system will abruptly quit
	 * @param message The quit message
	 */
	public void notifyAborting(String message);

	/**
	 * Notifies the UIs that a player profile was successfully loaded
	 */
	public void notifyLoadedProfile();

	/**
	 * Notifies the interface about a chat message
	 * 
	 * @param alias The alias of the client that sent the message
	 * @param chatMessage The chat message
	 */
	public void notifyChatMessage(String alias, String chatMessage);

	/**
	 * Notifies the interfaces that the server sent a "WHOSHERE" protocol message
	 * 
	 * @param aliasMap The clientId->alias mapping
	 * @param readyClientsSet The ready clients set
	 */
	public void notifyWhosHereMessage(Map<String, String> aliasMap, Set<String> readyClientsSet);

	/**
	 * Notifies the interface that the server has changed the map
	 * @param mapName
	 */
	public void notifyWhosHereMessage(String mapName);

	/**
	 * Changes the game server name
	 * @param selectedValue
	 * @throws CommunicationException 
	 */
	public void notifyServerName(String serverName);

	/**
	 * Notifies the interface that the client was disconnected
	 */
	public void notifyDisconnected();

	/**
	 * Notifies the interface about a client disconnection
	 * @param clientId
	 */	
	public void notifyClientDisconnected(String clientId);

	/**
	 * Notifies the interface that the server initialization phase
	 * has failed
	 * 
	 * @param cause The fail cause
	 */
	public void notifyInitPhaseFailed(String cause);

	/**
	 * Notifies the interface that the server initialization phase
	 * has started
	 */
	public void notifyInitPhaseStarted();

	/**
	 * Notifies the interface about an init phase status
	 * change
	 * 
	 * @param message
	 */
	public void updateInitStatus(String message);

	/**
	 *  Starts the game
	 * 
	 * @param robots The player's robot data
	 * @param positions The initial robot positions
	 * @param map The game map
	 */
	public void gameHasStarted(GameMap map, Map<String, Map<String, RobotPosition>> positions, Map<String, Map<String, Map<RobotPartCategory, String>>> robots);

	public void notifyCurrentTurn(String clientId, String playerAlias);

	public void notifyYourTurn();

	public void notifyTurnRobot(String robotName);

	public void notifyRobotMoved(String player, String robot, int x, int y);

	public void notifyRobotAttacked(String player, String robot, int target, int target2, String part, String attack);
}
